/*
 * File:   find_n_th_node_from_last_simple_test.c
 * Author: anantha
 *
 * Created on 20 Nov, 2011, 10:49:36 PM
 */

#include <stdio.h>
#include <stdlib.h>

#include "stack_using_linked_list.h"

/*
 * Simple C Test Suite
 */

ListNode* find_n_th_node_from_last(ListNode* head, int n);

void testFind_n_th_node_from_last() {
    ListNode* head=NULL;
    int n=2;
    head=createListNode(1);
    head->link=createListNode(2);
    head->link->link=createListNode(3);
    head->link->link->link=createListNode(4);
    head->link->link->link->link=createListNode(5);
    head->link->link->link->link->link=createListNode(6);
    ListNode* result = find_n_th_node_from_last(head, n);
    if (result->data!=5) {
        printf("%%TEST_FAILED%% time=0 testname=testFind_n_th_node_from_last (find_n_th_node_from_last_simple_test) message=error message sample\n");
    }
}

int main(int argc, char** argv) {
    printf("%%SUITE_STARTING%% find_n_th_node_from_last_simple_test\n");
    printf("%%SUITE_STARTED%%\n");

    printf("%%TEST_STARTED%%  testFind_n_th_node_from_last (find_n_th_node_from_last_simple_test)\n");
    testFind_n_th_node_from_last();
    printf("%%TEST_FINISHED%% time=0 testFind_n_th_node_from_last (find_n_th_node_from_last_simple_test)\n");

    printf("%%SUITE_FINISHED%% time=0\n");

    return (EXIT_SUCCESS);
}
